package br.com.romerito.gui.logo;


import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;

/**
 *
 * @author Romerito Campos
 */
public class ViewWindow {

    private Image viewWindow;    
    private GameCanvas canvas;    

    public ViewWindow(GameCanvas canvas) {

        this.canvas = canvas;

        viewWindow = Image.createImage(canvas.getWidth(),canvas.getHeight());

        Graphics g = viewWindow.getGraphics();
        g.drawString("x", viewWindow.getWidth()-3, viewWindow.getHeight() - 20, Graphics.RIGHT | Graphics.TOP);
        drawTextArea(g);
        
    }

    public Image getViewWindow() {
        return viewWindow;
    }

    public void drawTextArea(Graphics g){
        g.setColor(0, 0, 0);
        g.drawRect(1, canvas.getHeight()-22, canvas.getHeight(),canvas.getWidth());
    }
           

    public void actionPrint(boolean controlCmd, boolean controlArg, String cmdAct, String cmdArg) {
        Graphics g = viewWindow.getGraphics();
        if (controlCmd && controlArg) {            
            g.setColor(255, 255, 255);
            g.fillRect(0, canvas.getHeight() - 20, canvas.getWidth(), canvas.getHeight());
            g.setColor(0, 0, 0);
            g.drawString(cmdAct + cmdArg, 3, viewWindow.getHeight() - 20, Graphics.LEFT | Graphics.TOP);            
            g.drawString("x", viewWindow.getWidth()-3, viewWindow.getHeight() - 20, Graphics.RIGHT | Graphics.TOP);
        }
    }
   
}
